package com.sitanyun.merchant.guide.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sitanyun.merchant.guide.R;
import com.sitanyun.merchant.guide.bean.EmployeeBean;

/**
 * Created by jzl
 * on 2022/3/24.
 * 员工管理适配器
 */
public class EmplyeeAdapter extends BaseQuickAdapter<EmployeeBean.DataBean.RecordsBean, BaseViewHolder> {

    public EmplyeeAdapter(Context context) {
        super(R.layout.emp_item);
        this.mContext = context;
    }
    @Override
    protected void convert(BaseViewHolder helper, EmployeeBean.DataBean.RecordsBean item) {
        ImageView  headImage = helper.getView(R.id.myall_headImage);
        ImageView  name_duty = helper.getView(R.id.name_duty);
        TextView tv_sh = helper.getView(R.id.tv_sh);
        Glide.with(mContext).load(item.getHeadImg()).error(R.mipmap.cimg).into(headImage);
         helper.setText(R.id.myall_name,item.getStaffName());
        helper.setText(R.id.myall_phone,item.getPhone());
        helper.addOnClickListener(R.id.tv_sh);
        helper.addOnClickListener(R.id.ll_layout);
        switch (item.getStatus()){
            case 0:
                name_duty.setVisibility(View.VISIBLE);
                tv_sh.setText("审核");
                tv_sh.setBackgroundResource(R.drawable.shap_radio_yg);
                break;
            case 1:
                name_duty.setVisibility(View.GONE);
                tv_sh.setText("停用");
                tv_sh.setBackgroundResource(R.drawable.shap_radio_ty);
                break;
            case 2:
                Glide.with(mContext).load(R.mipmap.img_ty).into(name_duty);
                name_duty.setVisibility(View.VISIBLE);
                tv_sh.setText("启用");
                tv_sh.setBackgroundResource(R.drawable.shap_radio_yg);
                break;
            case 3:
                name_duty.setVisibility(View.GONE);
                tv_sh.setText("审核");
                tv_sh.setBackgroundResource(R.drawable.shap_radio_ty);
                break;
            case 4:
                name_duty.setVisibility(View.GONE);
                tv_sh.setText("已删除");
                tv_sh.setBackgroundResource(R.drawable.shap_radio_ty);
                break;
        }
    }
}
